#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int N, x, y, sum = 0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y;
        if (x > y) swap(x, y);
        for (int j = x + 1; j < y; j++)
        {
            if (j % 2)
                sum += j;
        }
        cout << sum << endl;
        sum = 0;
    }
    return 0;
}
